package br.com.cobranca.controller;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;
import br.com.cobranca.factory.fabricaBancos;
import br.com.cobranca.model.interfaces.Banco;

@Resource
public class BancoController {
	
	private Result result;
	private fabricaBancos factory;
	
	public BancoController(Result result, fabricaBancos factory) {
		this.result = result;
		this.factory = factory;
	}
	
	@Path("/")
	public void index(){
	}
	
	@Path("/faz")
	public void faz(String bancoNome, double valor){
		Banco banco = factory.bancoFactory(bancoNome);
		result.include("valorCobrar", banco.calculaValorCobranca(valor));
		result.include("valor", valor);
		result.redirectTo(this).index();
	}

}
